#include "StdAfx.h"
#include "OElement.h"
#include "LocalPane.h"

COElement::COElement(CLocalPane* pSquarePane, CPoint firstPoint, UINT nSquareWidth, ElementState state, SpinMode mode, COLORREF color) 
	: CElement(pSquarePane, firstPoint, nSquareWidth, OELEMENT_STATE_COUNT, color, state, mode)
{
	ASSERT(m_pSquarePane != NULL );

	ConstructSquareList(state, firstPoint, nSquareWidth, m_listSquare);
}

COElement::~COElement(void)
{
}

void COElement::ConstructSquareList(ElementState state, CPoint pntFirstPoint, UINT nSquareWidth, SquareList& listSquare) const
{
	listSquare.clear();

	for (int i = 0; i < 2; ++i)
	{
		listSquare.push_back(CSquare(m_pSquarePane, 
			CPoint(pntFirstPoint.x, pntFirstPoint.y + i * nSquareWidth), nSquareWidth, true, m_ElementColor));

		listSquare.push_back(CSquare(m_pSquarePane, 
			CPoint(pntFirstPoint.x + nSquareWidth, pntFirstPoint.y + i * nSquareWidth), nSquareWidth, true, m_ElementColor));
	}
}